package com.htgd.gardenexpo.dao;

import com.htgd.gardenexpo.entity.WxUserCollect;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户收藏表 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2024-06-26
 */
@Mapper
public interface WxUserCollectDao extends BaseMapper<WxUserCollect> {

    List<WxUserCollect> getFoodCollectByOpenIdAndType(@Param("openId") String openId, @Param("type")String type);

    List<WxUserCollect> getNewsCollectByOpenIdAndType(@Param("openId") String openId, @Param("type")String type);

    List<WxUserCollect> getSceneCollectByOpenIdAndType(@Param("openId") String openId, @Param("type")String type);

    List<WxUserCollect> getSportCollectByOpenIdAndType(@Param("openId") String openId, @Param("type")String type);

    List<WxUserCollect> getHealthyCollectByOpenIdAndType(@Param("openId") String openId, @Param("type")String type);

    @Select("SELECT COUNT(1) FROM `wx_user_collect` WHERE type = #{type}")
    long getTypeCount(@Param("type") String type);
}
